#ifndef POSE_GL_H
#define POSE_GL_H

#include <GL/glew.h>
#include <glm/glm.hpp>
#include <glm/gtc/type_ptr.hpp>
#include <glm/gtc/matrix_transform.hpp>

#include <thread>
#include <array>
#include <mutex>
#include <functional>

#include "Coord3D.hpp"

class PoseGL
{
  public:
    PoseGL();
    virtual ~PoseGL();
    void ShowPose(const std::array<Cood3D,25> & pose);
    void Init(int width,int height);
    void Display();
    void Resize(int width,int height);
  private:
    std::mutex poseListMut;
    std::array<Cood3D,25> poseList;

    //OpenGL
    float cameraX, cameraY, cameraZ;
    float objCenterX=0,objCenterY=0,objCenterZ=0;
    GLuint renderingProgram1,renderingProgram2;
    GLuint vao[1];
    GLuint vbo[3];

    // variable allocation for display
    GLuint mvLoc, projLoc;
    int width, height, displayLoopi;
    float aspect;
    float tf;
    float routVal;
    glm::mat4 pMat, xflipMat, vMat , tMat, rMat,sMat, mMat, mvMat,lookat;
    std::mutex initMut;
    bool ExitFlag=false;
    bool bufferRefreshFlag=true;
    
    void setupVertices();
    void setupLines();
};

#endif
